<template>
  <div>
    <h4>npm i vue-print-nb</h4>
    <el-button v-print="printObj">打印</el-button>
    <div ref="printTest" id="printTest">
      <div>这里就是你所要打印的内容</div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive } from 'vue'

const printObj = reactive({
  id: 'printTest', // 绑定打印区域的id
  beforeOpenCallback(vue: any) {
    vue.printLoading = true
    console.log('打开之前')
  },
  openCallback(vue: any) {
    vue.printLoading = false
    console.log('执行了打印')
  },
  closeCallback() {
    console.log('关闭了打印工具')
  }
})
</script>
<style lang="scss" scoped></style>
